package com.xiaoshuidi.cloud.module.member.mapper.point;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xiaoshuidi.cloud.module.member.controller.admin.point.vo.MemberPointsPageReqVo;
import com.xiaoshuidi.cloud.module.member.controller.admin.point.vo.MemberPointsPageRespVo;
import com.xiaoshuidi.cloud.module.member.controller.app.point.vo.TenantPointsDto;
import com.xiaoshuidi.cloud.module.member.controller.app.point.vo.TenantPointsParamDto;
import com.xiaoshuidi.cloud.module.member.controller.app.point.vo.TenantPointsVo;
import com.xiaoshuidi.cloud.module.member.pojo.point.MemberPointsEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author neil
 * @version generator
 * @description 租客积分Mapper层
 * @date 2022-12-14 18:08:07
 */
@Mapper
public interface MemberPointsMapper extends BaseMapper<MemberPointsEntity> {

    /**
     * 列表查询
     *
     * @param paramDto 筛选条件
     * @param start    分页开始
     * @param end      分页结束
     * @return
     */
    @Select({"<script>"

            + "select * "

            + " from tenant_points tenantpoints"

            + " where 1=1"

            + " order by tenantpoints.created_time desc"

            + " limit #{start},#{end}" + "</script>"})
    List<TenantPointsDto> list(@Param("dto") TenantPointsParamDto paramDto, @Param("start") Integer start, @Param("end") Integer end);

    List<MemberPointsPageRespVo> selectTenantPointsPage(IPage<MemberPointsPageReqVo> page, @Param("reqVo") MemberPointsPageReqVo reqVo);

    List<MemberPointsPageRespVo> selectTenantPointsPage(@Param("reqVo") MemberPointsPageReqVo reqVo);

    TenantPointsVo getTenantPointsVoByUserId(Long id);

    void updateUserId(@Param("oldUserId") Long oldUserId, @Param("userId") Long userId);
}
